Skip to content

Fuzz: Display roundtrip - #2528

Merged
LucaCappelletti94 merged 2 commits into
mainfrom
fuzz-roundtrip-harness
Sep 22, 2026
Merged

LucaCappelletti94 merged 2 commits into
mainfrom
fuzz-roundtrip-harness

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

Step 3 of #2519, stacked on #2527.

This PR adds the display roundtrip harness for all dialects.

A first 60 seconds run already finds SELECT [a]]b] in MsSqlDialect rendering as SELECT [a]b], which fails to re-parse. That is the bug class of #2409, already being fixed in #2418, so this harness should help guide that PR.

.clusterfuzzlite/build.sh iterates over cargo fuzz list, so the new target is picked up by the CI builds with no workflow change.

@LucaCappelletti94
LucaCappelletti94 added this pull request to stack #2529 September 19, 2026 05:47
@LucaCappelletti94
LucaCappelletti94 marked this pull request as ready for review September 19, 2026 06:04
@LucaCappelletti94

Copy link
Copy Markdown
Contributor Author

@alamb any notes on this one?

Base automatically changed from clusterfuzzlite-gate to main September 21, 2026 20:24
@LucaCappelletti94 LucaCappelletti94 added the fuzzer A bug found by the fuzzer label Sep 21, 2026

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use sqlparser::parser::Parser;

fuzz_target!(|sql: &str| {
let dialects: [(&str, &dyn Dialect); 14] = [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be nice to use a pre-existing dialect enum for this (or add it somewhere) so that newly added dialects automatically get coverage

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, I made sure to extend the harnesses and include all of the dialects we are currently cover. I have spent a little while thinking about what could be the cleanest variant going forward but I am not too sure for now. Almost surely, it will be some code we move from the test suites into the lib under a test cfg.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just a function in sqlparser like

fn all_dialects() -> Vec<Box<dyn Dialect>>

or something 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have such a function in the test suite, that is why I was saying it should be moved from there into the library proper.

@LucaCappelletti94
LucaCappelletti94 force-pushed the fuzz-roundtrip-harness branch 2 times, most recently from 38705fa to a30e374 Compare September 22, 2026 08:15
@LucaCappelletti94
LucaCappelletti94 added this pull request to the merge queue Sep 22, 2026
Merged via the queue into main with commit d6afa01 Sep 22, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fuzzer A bug found by the fuzzer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants